<?php
session_set_cookie_params(864000);
set_magic_quotes_runtime(0);
if (isset($_REQUEST[session_name()]) || isset($_COOKIE['usid'])) {session_start();};
//session_destroy();
//echo "<br><a href=".$_SERVER['PHP_SELF'].">обновить"; 
//ini_set('display_errors',1); error_reporting(E_ALL);
include ("include/start.inc.php");
include ("include/config.inc.php");
include ("include/setting.inc.php");
include ("include/function.inc.php");
if (get_magic_quotes_gpc()) {
    $_GET    = my_stripSlashes($_GET);
    $_POST   = my_stripSlashes($_POST);
    $_COOKIE = my_stripSlashes($_COOKIE);
}
$useragent=$_SERVER['HTTP_USER_AGENT'];
$ip=$_SERVER['REMOTE_ADDR'];
if ($_SESSION['uagent']==$useragent && $_COOKIE['usid']==$_SESSION['usid']) 
{$auth='1'; define('auth','1',TRUE);};
ob_get_contents();
ob_end_flush();
ob_start ("ob_gzhandler");
$login=$_SESSION['ulogin'];
$id=$_SESSION['uid'];
require ("include/get.inc.php");
require ("include/title.inc.php");
//require ("include/cryptpass.inc.php");

date_default_timezone_set('Europe/Moscow');
require_once 'lib/bbcode/bbcode.lib.php';
$tz="3:00";
//include ("include/func.inc.php");
if ($auth=='1') {
if ($_SESSION['admin']=='rasp') {$admin='rasp';};
if ($_SESSION['admin']=='admin') {$admin='admin';};
//if (isset($style)) {sql_query("UPDATE user SET style='$style' WHERE id='$id'");}
if (isset($font)) {sql_query("UPDATE user SET font='$font' WHERE id='$id'");}
$profres = sql_query("SELECT * FROM user WHERE id='$id'"); //извлекаем из базы все данные о пользователе
$prof = mysql_fetch_array($profres);
$tz=$prof['timezone'];
}
$posmin=strpos ( $tz , ":");
for ($i=0;$i<$posmin;$i++)
{ $hourtz.=$tz[$i];}
for ($i=$posmin+1;$i<$posmin+3;$i++)
{ $mintz.=$tz[$i];}
$minut=date("i")+$mintz;
$chas=date("H")+$hourtz-3;
$day=date("d");
$month=date("m");
$year=date("Y");
$second=date("s");
if ($month==1) {$prevmonth=cal_days_in_month(CAL_GREGORIAN, 12, $year);} else
{$prevmonth=cal_days_in_month(CAL_GREGORIAN, $month-1, $year);}
$nowmonth=cal_days_in_month(CAL_GREGORIAN, $month, $year);
if ($minut>59) {$minut=$minut-60;$chas++;} 
if ($minut<10) {$minut='0'.$minut;} 
if ($chas>23) {$chas=$chas-24;$day++;}
if ($chas<0) {$chas=24+$chas;$day--;}
if ($day<1) {$day=$prevmonth;$month--;}
if ($day>$nowmonth) {$day=1;$month++;}
if ($month<1) {$month=12;$year--;}
if ($month>12) {$month=1;$year++;}
if (dirname($_SERVER['PHP_SELF'])!='\\') ($dir='../');
$ned=strftime("%W");
$perv_sem=$ned-35+1;
$vtor_sem=$ned+17+1;
if ($ned<35) {
if ($vtor_sem%2==0) {$chet=1;} else {$chet=0;}
$week=$vtor_sem;
} else {
$week=$perv_sem;
if ($perv_sem%2==0) {$chet=1;} else {$chet=0;}}
if (!isset($templateshead)) {require ($dir."templates/$templates/header.php");} else {require ($dir."templates/$templates/emptyheader.php");}
include ("include/info.inc.php");
?>